abstract class AppException implements Exception {
  final String message;
  final int code;

  AppException({required this.message, required this.code});

  @override
  String toString() => 'AppException: $message (code: $code)';
}

class NetworkException extends AppException {
  NetworkException(String message) : super(message: message, code: 1001);
}

class ServerException extends AppException {
  ServerException(String message, int code) : super(message: message, code: code);
}

class AuthenticationException extends AppException {
  AuthenticationException(String message) : super(message: message, code: 401);
}

class ValidationException extends AppException {
  ValidationException(String message) : super(message: message, code: 422);
}

class TimeoutException extends AppException {
  TimeoutException(String message) : super(message: message, code: 408);
}

class UnknownException extends AppException {
  UnknownException(String message) : super(message: message, code: 500);
}